package net.qiqb.ddd.user.application;

import lombok.extern.slf4j.Slf4j;
import net.qiqb.core.executing.annotation.Command;
import net.qiqb.core.executing.annotation.HandleBusiness;
import net.qiqb.core.executing.annotation.ObtainAggregateObject;
import net.qiqb.ddd.user.domain.ExtraAgeUser;
import net.qiqb.ddd.user.domain.UserAggregateRoot;
@Slf4j
@Command(ExtraAgeUser.class)
public class UserAgeCmd {

    private final Integer age;

    public UserAgeCmd(Integer age) {
        this.age = age;
    }

    @ObtainAggregateObject
    public ExtraAgeUser obtain() {
        log.info("获取额外用户年龄");
        return new ExtraAgeUser(age);
    }


    @HandleBusiness
    public void handle(UserAggregateRoot userEntity) {
        log.info("获取额外用户年龄后执行业务流程");
    }
}
